package com.ye.controller;

import com.alibaba.fastjson.JSONObject;
import com.ye.pojo.School;
import com.ye.pojo.Student;
import com.ye.pojo.Subject;
import com.ye.pojo.Teacher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: TODO
 * @author: scott
 * @date: 2022年03月31日 18:20
 */
@RestController
@RequestMapping("/config")
public class ConfigController {

    @Autowired
    private Student student;

    @Autowired
    private School school;

    @Autowired
    private Subject subject;

    @Autowired
    private Teacher teacher;

    @GetMapping("/student")
    public String getStudent() {
        JSONObject jsonpObject = (JSONObject) JSONObject.toJSON(student);
        return jsonpObject.toJSONString();
    }

    @GetMapping("/school")
    public String getSchool() {
        JSONObject jsonpObject = (JSONObject) JSONObject.toJSON(school);
        return jsonpObject.toJSONString();
    }

    @GetMapping("/subject")
    public String getSubject() {
        JSONObject jsonpObject = (JSONObject) JSONObject.toJSON(subject);
        return jsonpObject.toJSONString();
    }

    @GetMapping("/teacher")
    public String getTeacher() {
        JSONObject jsonpObject = (JSONObject) JSONObject.toJSON(teacher);
        return jsonpObject.toJSONString();
    }
}
